package controller.SaleTable;

import entity.MsgResult;
import entity.sale;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import service.DeleteSaleService;

@Controller
public class DeleteSaleController {

    @Autowired
    private DeleteSaleService deleteSaleService;

    @RequestMapping("/deleteSale")
    @ResponseBody
    public MsgResult deleteSale(sale sale){
        MsgResult msgResult = new MsgResult();
        boolean b = deleteSaleService.deleteSale(sale.getsId());
        if(b){
            msgResult.setFlag(1);
            msgResult.setMsg("删除销售记录成功");
            return msgResult;
        }
        msgResult.setFlag(1);
        msgResult.setMsg("删除销售记录失败");
        return msgResult;
    }
}
